<?php 


$arrData = $this->arrData;
$arrError = $this->arrError;

$value_status = 1;
if(isset($arrData['status'])){
	$value_status = $arrData['status'];
}

$name = $this->formText('name',$arrData['name'],array('style'=>'width:274px;'));

$level1 = $this->level1;
foreach ($level1 as $val){
	$key = $val['id'];
	$options[$key] = $val['name'];
}

$parent = '<div style="float: left;padding-right:10px;padding-top:3px;"><input type="radio" name="radio" id="type1" value="0" checked="checked" onclick="level1()" />
           <span>Level 1</span>
           <input type="radio" name="radio" id="type2" value="1" onclick="level2()"/> 
           <span>Level 2</span></div>' . '<div id="level1"></div><div id="level2">
			' . $this->formSelect('parent',0,array('style'=>'margin-top:3px;'),$options) . '</div>';
$status = $this->formHidden('status',$value_status,array('id'=>'status'));
$order = $this->formText('order',$arrData['order'],array('style'=>'width:274px;'));

$lnkSubmit = $this->url(array('module'=>'admin','controller'=>'category','action'=>'add'));
$lnkBack = $this->url(array('module'=>'admin','controller'=>'category','action'=>'index'));
?>
<div class="content-box">
			<div class="box-body">
				<div class="box-header clear">
					<h2>Add Category</h2>
				</div>
				
				<div class="box-wrap clear">

					<form id="appForm" name="appForm" action="" method="post" class="validate-form form bt-space15">
					
					<div class="columns clear bt-space15">
						<div class="col2-3">
							
							<?php if(count($arrError) > 0){
								echo '<div class="notification note-error">
								<a href="#" class="close" title="Close notification">close</a>';
								foreach ($arrError as $key => $val){
							?>
							
								<p><strong><?php echo $key . ': ';?></strong><?php echo $val?></p>
							
							<?php 		
								}
								echo '</div>';
							}?>
							<div class="form-field clear">
								<label for="name" class="form-label size-120 fl-space2">Name: <span class="required">*</span></label>
								<?php echo $name;?>
							</div><!-- /.form-field -->
							
							<div class="form-field clear">
								<label for="parent" class="form-label size-120 fl-space2">Parent: <span class="required">*</span></label>
								<?php echo $parent;?>
							</div><!-- /.form-field -->

							<div class="form-field clear">
								<label for="status" class="form-label size-120 fl-space2">Status:</label>
								<div id="radio"><?php echo $status;?></div>
								<span class="switch-wrapper small">									
									<span class="switch-enable <?php if($value_status == 1) echo 'selected';?>">Enable</span>
									<span class="switch-disable <?php if($value_status == 0) echo 'selected';?>">Disable</span>
								</span>								
							</div><!-- /.form-field -->							
                                                        							
							<div class="form-field clear">
								<div class="fl-space2"><label for="order" class="form-label size-120">Order:</label> <span id="error-textarea"></span></div>
								<?php echo $order;?>
							</div><!-- /.form-field -->
							</br><button class="green" type="button" onclick="onSubmitForm('appForm','<?php echo $lnkSubmit;?>')">Đồng ý</button>
							<button class="red" type="button" onclick="toSite('<?php echo $lnkBack;?>')">Back</button>	
						</div>
																														
					
					</form>
					
					</div><!-- end of box-wrap -->
			</div> <!-- end of box-body -->
</div>